package ex161;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
 
public class MainOld {
 
    public static void main(String args[]) throws IOException {
 
        InputStreamReader it = new InputStreamReader(System.in);
        BufferedReader in = new BufferedReader(it);
         
        int m, n, mFat, nFat, soma = 0;
        String input, inputParts[];
        ArrayList<Integer> result = new ArrayList<Integer>();
         
        while((input = in.readLine()) != null) {
             
            if (!input.trim().equals("")) {
                inputParts = input.split(" ", 2);
                m = Integer.parseInt(inputParts[0]);
                n = Integer.parseInt(inputParts[1]);
                 
                mFat = m==0?1:m;
                nFat = n==0?1:n;
                 
                for (int i = m-1; i >= 2 ; i--) {
                    mFat = mFat * i;
                }
                for (int i = n-1; i >= 2 ; i--) {
                    nFat = nFat * i;
                }
                soma = mFat + nFat;
                result.add(soma);
            } else {
                break;
            }
             
        }
         
        for (int i = 0; i < result.size(); i++) {
            System.out.println(result.get(i));
        }
         
    }
     
}